package com.webinsky.web.utils;

import java.util.Random;

public class CodeUtils {
	private static char[] codeSequence = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
            'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
	
	public static String genCode(int len){
		Random random = new Random();
		StringBuffer code = new StringBuffer();
		for ( int i = 0; i < len; i ++ ){
			char ranCode = codeSequence[random.nextInt(36)];
			code.append(ranCode);
		}
		return code.toString();
	}
	/*
	public static void main(String[] args) {
		System.out.println(CodeUtils.genCode(5));
	}
	*/
}
